package sprites;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;

public abstract class Sprite {
	protected final int DEF_TILE = 40;
	
	protected Image img;
	protected int height = 0;
	protected int width = 0;
	protected int x;
	protected int y;
	
	protected boolean active = true;
	protected boolean passable = true;

	public void setX(int x) {
		this.x = x;
	}

	public void setY(int y) {
		this.y = y;
	}
	
	public void setActive(boolean b) {
		active = b;
	}
	
	public boolean isActive() {
		return active;
	}
	public boolean isPassable() {
		return passable;
	}

	public int getHeight() {
		return height;
	}

	public int getWidth() {
		return width;
	}

	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}

	public void setImage(Image i) {
		if (i == null)
			return;
		img = i;
		height = img.getHeight(null);
		width = img.getWidth(null);
	}

	public void draw(Graphics g) {
		if (!isActive()) return;
		g.drawImage(img, x, y, null);
	}
}
